/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gn.eugene.equals;

/**
 *
 * @author Eugene
 */
public class People
{

    private String name;
    private int age;
    private int height;

    People(String newName, int newAge, int newHeight)
    {
        name = newName;
        age = newAge;
        height = newHeight;
    }

    public void setName(String newName)
    {
        name = newName;
    }

    public String getName()
    {
        return name;
    }

    public void setAge(int newAge)
    {
        age = newAge;
    }

    public int getAge()
    {
        return age;
    }

    public void setHeight(int newHeight)
    {
        height = newHeight;
    }

    public int getHeight()
    {
        return height;
    }

    public int hashCode()
    {
     return (int) (31 * this.getAge() + this.getName().hashCode());
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj)
        {
            return true;
        }
        if (obj == null)
        {
            return false;
        }
        if (this.getClass() == obj.getClass())// obj instanceof People 
        {
            People temp = (People) obj;
            return this.getName() == temp.getName()
                    && this.getAge() == temp.getAge()
                    && this.getHeight() == temp.getHeight();
        }

        return false;
    }
}